home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / bgecho.zip / GOODDAY.ASM < prev    next >
Assembly Source File  |  1986-09-12  |  3KB  |  130 lines

  1. cseg segment
  2.          assume cs:cseg , ds:cseg
  3.          org 100H
  4. enter:jmp begin
  5. ;---------------------------------
  6.          db 13,'GOODDAY from R.M.Wilson, c(o) 1986',26
  7. string1  db '   Good   ',0DH
  8. string2  db ' Morning! ',0DH
  9. string3  db 'Afternoon!',0DH
  10. string4  db ' Evening! ',0DH
  11. string5  db '  Night!  ',0DH
  12. string6  db ' T G I F  ',0DH
  13.  
  14. hold db 80 dup(0)     ;Holds 8 bytes for 10 characters.
  15. screen dw 0B000H      ;Will be set correctly.
  16. ;---------------------------
  17.    begin:xor ax,ax    ;First, decide which monitor.
  18.          mov ds,ax
  19.          mov ax,0B000H
  20.          test byte ptr ds:[410H],10H
  21.          jne over1
  22.          add ax,800H  ;if color monitor
  23.          over1:push cs
  24.          pop ds
  25.          mov screen,ax
  26.          mov es,ax
  27.          mov cx,2000
  28.          mov ax,1320H
  29.          xor di,di
  30.          rep stosw     ;Clear screen.
  31.  
  32.          xor bp,bp
  33.          xor di,di
  34.          call send     ;Say "Good".
  35.  
  36.          mov ah,2CH
  37.          int 21H       ;Get time.
  38.          cmp ch,6
  39.          jb nigh
  40.          cmp ch,12
  41.          jb morn
  42.          cmp ch,18
  43.          jb afte
  44.          jmp short even
  45.  
  46. morn:    mov bp,11 
  47.          jmp short over2  
  48. afte:    mov bp,22 
  49.          jmp short over2  
  50. even:    mov bp,33 
  51.          jmp short over2  
  52. nigh:    mov bp,44 
  53.          jmp short over2
  54.  
  55.    over2:mov di,8*160 
  56.          call send 
  57.          mov ah,2AH    ;Check whether it's Friday.
  58.          int 21H
  59.          cmp al,5
  60.          jne cursor
  61.          mov bp,55
  62.          mov di,17*160
  63.          call send
  64. cursor:  xor bh,bh     ;Place the cursor and return.
  65.          mov dx,0F00H
  66.          mov ah,2
  67.          int 10H
  68.          ret
  69. ;------------------------------------------
  70.  
  71. form:    mov bl,cs:string1[bp]
  72.          cmp bl,0DH
  73.          jne over
  74.          ret
  75.        over:xor bh,bh
  76.          shl bx,1
  77.          shl bx,1
  78.          shl bx,1        ;mult by 8
  79.          push si
  80.          add si,bx  
  81.          mov cx,8
  82.          rep movsb
  83.          pop si
  84.          inc bp
  85.          jmp form
  86.  
  87. send:    push di         ;This routine writes the message at offset 3+bp
  88.          push cs         ;on the screen starting at offset di.
  89.          pop es
  90.          mov si,0FA6EH   ;Point ds:si to address in ROM 
  91.          mov ax,0F000H   ;where character set is stored.
  92.          mov ds,ax
  93.          mov di,offset hold
  94.          call form
  95.          push cs
  96.          pop ds
  97.          pop di
  98.          mov ax,cs:screen
  99.          mov es,ax
  100.          xor bp,bp
  101.  
  102.          up2:mov si, offset hold
  103.          add si,bp
  104.                    mov cx,10
  105.                    up:lodsb
  106.                                mov bl,80H   ;8 bytes
  107.                                up3:push ax
  108.                                mov dl,32
  109.                                and al,bl
  110.                                jz over4
  111.                                mov dl,219
  112.                                over4:mov es:[di],dl
  113.                                mov byte ptr es:[di+1],13H
  114.                                inc di
  115.                                inc di
  116.                                ror bl,1
  117.                                pop ax
  118.                                cmp bl,80H
  119.                                jne up3
  120.                    add si,7
  121.                    loop up
  122.          inc bp
  123.          cmp bp,8
  124.          jl up2
  125.          ret
  126. ;-----------------------
  127. cseg ends
  128. end enter
  129.  
  130.